package com.aspose.cells.a.d;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

public class zgg {
   private int a = 1;
   private zct b;
   private com.aspose.cells.zal c;
   private zgh d;
   private zgd e;
   private ArrayList f = new ArrayList();
   private ArrayList g = new ArrayList();
   private HashMap h = new HashMap();
   private com.aspose.cells.b.a.b.zt i;

   public zgg(zct var1) throws Exception {
      this.b = var1;
      this.d();
   }

   public void a() throws Exception {
      zcv var1 = this.b.b().a("/Documents/1/FixedDocument.fdoc");
      Iterator var2 = this.e.e().keySet().iterator();

      while(var2.hasNext()) {
         Object var3 = var2.next();
         zfq var4 = ((zft)this.e.e().get(var3)).a();
         if (var4.w()) {
            var1.e().a("http://schemas.microsoft.com/xps/2005/06/restricted-font", (String)var3, false);
         }
      }

      this.c.b();
      this.e();
      this.f();
      this.e.a();
      zcz.a(this.b, false);
      zcr.a(this.b, false);
   }

   public void a(float var1, float var2) throws Exception {
      this.c.b("PageContent");
      this.c.c("Source", com.aspose.cells.b.a.zv.a("Pages/{0}.fpage", this.a));
      this.e.a(this.a);
      this.d = new zgh(this.e, new com.aspose.cells.zal(this.e.c().d(), true), true);
      this.d.a(this.a, var1, var2);
   }

   public void b() throws Exception {
      if (this.f != null && this.f.size() > 0) {
         this.c.b("PageContent.LinkTargets");
         Iterator var1 = this.f.iterator();

         while(var1.hasNext()) {
            String var2 = (String)var1.next();
            this.c.b("LinkTarget");
            this.c.c("Name", var2);
            this.c.c();
         }

         this.f.clear();
         this.c.c();
      }

      this.c.c();
      this.d.a();
      this.e.b();
      ++this.a;
   }

   public void a(com.aspose.cells.b.a.b.zt var1) throws Exception {
      if (this.a == 1) {
         this.i = var1;
      }

      String var2 = com.aspose.cells.b.a.zv.a("{0}{1}", var1.b(), var1.c());
      String var3 = (String)this.h.get(var2);
      if (var3 == null) {
         var3 = com.aspose.cells.b.a.zv.a("/Documents/1/Metadata/Page{0}_PT.xml", this.a);
         this.h.put(var2, var3);
         zcv var4 = new zcv(var3, "application/vnd.ms-printing.printticket+xml");
         zgo.a(new com.aspose.cells.zal(var4.d(), true), var1, true);
         this.b.b().a(var4);
      }

      this.e.c().e().a("http://schemas.microsoft.com/xps/2005/06/printticket", var3, false);
   }

   private void a(zcv var1) throws Exception {
      zcv var2 = new zcv("/Metadata/MXDC_Empty_PT.xml", "application/vnd.ms-printing.printticket+xml");
      zgo.a(new com.aspose.cells.zal(var2.d(), true));
      var1.e().a("http://schemas.microsoft.com/xps/2005/06/printticket", var2.a(), false);
      this.b.b().a(var2);
   }

   private void b(zcv var1) throws Exception {
      zcv var2 = new zcv("/Metadata/Job_PT.xml", "application/vnd.ms-printing.printticket+xml");
      zgo.a(new com.aspose.cells.zal(var2.d(), true), this.i, false);
      var1.e().a("http://schemas.microsoft.com/xps/2005/06/printticket", var2.a(), false);
      this.b.b().a(var2);
   }

   private void d() throws Exception {
      this.e = new zgd(this.b);
      zcv var1 = new zcv("/Documents/1/FixedDocument.fdoc", "application/vnd.ms-package.xps-fixeddocument+xml");
      this.c = new com.aspose.cells.zal(var1.d(), false);
      this.c.a("FixedDocument");
      this.c.c("xmlns", "http://schemas.microsoft.com/xps/2005/06");
      this.a(var1);
      this.b.b().b(var1);
   }

   private void e() throws Exception {
      zcv var1 = new zcv("/FixedDocumentSequence.fdseq", "application/vnd.ms-package.xps-fixeddocumentsequence+xml");
      com.aspose.cells.zal var2 = new com.aspose.cells.zal(var1.d(), false);
      var2.a("FixedDocumentSequence");
      var2.c("xmlns", "http://schemas.microsoft.com/xps/2005/06");
      var2.b("DocumentReference");
      var2.c("Source", "Documents/1/FixedDocument.fdoc");
      var2.c();
      var2.b();
      this.b.c().a("http://schemas.microsoft.com/xps/2005/06/fixedrepresentation", "/FixedDocumentSequence.fdseq", false);
      this.b(var1);
      this.b.b().a(var1);
   }

   private void f() throws Exception {
      zcv var1 = new zcv("/docProps/core.xml", "application/vnd.openxmlformats-package.core-properties+xml");
      com.aspose.cells.zal var2 = new com.aspose.cells.zal(var1.d(), false);
      zcs.a(var2, this.e.d().b(), this.e.d().c(), this.e.d().d(), this.e.d().e(), this.e.d().f(), this.e.d().g(), this.e.d().h(), this.e.d().j(), this.e.d().k(), this.e.d().l(), this.e.d().i());
      this.b.c().a("http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", "/docProps/core.xml", false);
      this.b.b().a(var1);
   }

   public zgh c() {
      return this.d;
   }
}
